﻿using Jayden.Dll.Core.Logging;

namespace Jayden.Dll.Core.Exceptions
{
	public class Exception : System.Exception
	{
		private Level m_ExceptionLevel;
		private ulong m_ExceptionCode = 0;
		private string m_MessageFormat;
		private object[] m_MessageArgs;

		public Exception() { }
		public Exception(ulong code) { m_ExceptionCode = code; }

		public Exception(string message, params object[] args) : base(string.Format(message, args)) { m_MessageFormat = message; m_MessageArgs = args; }
		public Exception(Level level, string message, params object[] args) : this(message, args) { m_ExceptionLevel = level; }
		public Exception(ulong code, string message, params object[] args) : this(message, args) { m_ExceptionCode = code; }
		public Exception(ulong code, Level level, string message, params object[] args) : this(level, message, args) { m_ExceptionCode = code; }

		public Exception(string message, System.Exception innerException, params object[] args) : base(string.Format(message, args), innerException) { m_MessageFormat = message; m_MessageArgs = args; }
		public Exception(Level level, string message, System.Exception innerException, params object[] args) : this(message, innerException, args) { m_ExceptionLevel = level; }
		public Exception(ulong code, string message, System.Exception innerException, params object[] args) : this(message, innerException, args) { m_ExceptionCode = code; }
		public Exception(ulong code, Level level, string message, System.Exception innerException, params object[] args) : this(level, message, innerException, args) { m_ExceptionCode = code; }

		public string MessageFormat { get { return m_MessageFormat; } }
		public object[] MessageArgs { get { return m_MessageArgs; } }
		public ulong ExceptionCode { get { return m_ExceptionCode; } }
		public Level ExceptionLevel { get { return m_ExceptionLevel; } }
	}
}
